Add ax_tree_walk: readable roles + addressable node paths for a11y dumps#399
Merged
Conversation
dump_accessibility_tree emits the platform's raw role (on Windows the bare UIA ControlType id, e.g. ControlType_50000) and a serialised dump carries no stable per-node identity. Add the pure post-processing it lacks: a ControlType-id to friendly-name table, whole-tree role humanization, a stable positional path per node (a pure stand-in for RuntimeId), and path resolution. AC_walk_tree is the readable counterpart to AC_a11y_dump.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 32 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Why
dump_accessibility_treeemits each node with the platform's raw role — on Windows the bare UIA ControlType id, e.g.ControlType_50000for a button — which is unreadable, and a serialised dump carries no stable per-node identity (UIA RuntimeId needs the live element).ax_tree_walkadds the pure, platform-agnostic post-processing the dump lacks, composable on top of anydump_accessibility_treeoutput:control_type_name/humanize_role— ControlType id (or"ControlType_NNNNN"/"NNNNN") → friendly namehumanize_tree— deep copy of the tree with every role humanisedassign_node_paths— deep copy stamping each node with a stable positionalpath("0.2.1"), a pure stand-in for RuntimeIdfind_by_path— resolve a node back from its pathUnknown ids and non-UIA roles (
"AXApplication") pass through unchanged.Design
AXTreeNode— no device/backend access, noPySide6.__all__→AC_walk_tree(humanised + path-stamped dict; the readable counterpart toAC_a11y_dump) andAC_humanize_roleexecutor commands → read-onlyac_*MCP tools → Script Builder (Native UI).Tests
test/unit_test/headless/test_ax_tree_walk_batch.py— pure-function cases (table, all role forms, deep-copy isolation, path round-trip) plus the_walk_treeexecutor path exercised via a fake backend returningControlType_*elements, and 5-layer wiring. 23 passed alongside the sibling a11y batches.